package com.coderly.onlinegallerysharingplatform.service;

import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.coderly.onlinegallerysharingplatform.common.response.Response;
import com.coderly.onlinegallerysharingplatform.model.dao.entity.UserDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.coderly.onlinegallerysharingplatform.model.dto.req.user.ChangePhoneReqDTO;
import com.coderly.onlinegallerysharingplatform.model.dto.req.user.GetUserReqDTO;
import com.coderly.onlinegallerysharingplatform.model.dto.req.user.SendVerificationCodeReqDTO;
import com.coderly.onlinegallerysharingplatform.model.dto.req.user.UserLoginAndRegisterReqDTO;
import com.coderly.onlinegallerysharingplatform.model.dto.resp.user.GetUserDateCountInfoRespDTO;
import com.coderly.onlinegallerysharingplatform.model.dto.resp.user.UserRespDTO;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author 26788
 * @description 针对表【t_user(用户表)】的数据库操作Service
 * @createDate 2025-03-03 22:32:51
 */
public interface UserService extends IService<UserDO> {




    /**
     * 用户登录/注册
     * @param requestParam
     * @return
     */
    String loginAndRegister(UserLoginAndRegisterReqDTO requestParam);

    /**
     * 发送短信验证码
     *
     * @param sendVerificationCodeReqVO
     * @return
     */
    void send(SendVerificationCodeReqDTO sendVerificationCodeReqVO);

    /**
     * 获取登录用户
     * @param request
     * @return
     */
    UserDO getLoginUser();

    /**
     * 退出登录
     * @return
     */
    Boolean logout();

    /**
     * 获取脱敏后的用户
     * @param userDO
     * @return
     */
    UserRespDTO getUser(UserDO userDO);

    List<UserRespDTO> getUserList(List<UserDO> userDOList);


    QueryWrapper<UserDO> getQueryWrapper(GetUserReqDTO requestParam);

    Response<GetUserDateCountInfoRespDTO> getUserDateCountInfo(long userId);

    /**
     * 获取用户近半年发布图片热点图
     *
     * @return
     */
    Map<LocalDate, Long> getUserPictureUploadHeatMap();

    /**
     * 修改手机号
     * @param changePhoneReqDTO
     * @return
     */
    Boolean changePhone(ChangePhoneReqDTO changePhoneReqDTO);


    /**
     * 判断指定用户是否存在
     * @param userId
     * @return
     */
    default Boolean exist(Long userId) {
        return ObjUtil.isNotNull(this.getById(userId));
    }
}


